//
// Created by 刘禹晨 on 16/7/17.
// Copyright (c) 2016 yuchenliu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CocoaAsyncSocket/GCDAsyncSocket.h>

enum{
    SocketOfflineByServer,// 服务器掉线，默认为0
    SocketOfflineByUser,  // 用户主动cut
};

@protocol SocketManagerDelegate

@optional
-(void)didStopScan;
-(void)didFoundPeripheral;
-(void)didReadvalue:(NSData *)data;
-(void)didSocketConnected;
@required
-(void)didDisconnect;

@end

@interface SocketManager : NSObject
+ (SocketManager *)instance;
-(void)socketConnectHost;
-(void)socketDisconnect;
-(void)initSocket;

@property (weak, nonatomic) id<SocketManagerDelegate> delegate;
@property (nonatomic, strong) GCDAsyncSocket *socket;
@property (nonatomic, copy) NSString *socketHost;
@property (nonatomic, assign) UInt16 socketPort;

@property (nonatomic, retain) NSTimer *connectTimer; // 计时器

@end